﻿using System.IO;
using log4net;
using log4net.Config;
using Nakio.Framework.Properties;

namespace Nakio.Framework
{
    /// <summary>
    /// Class for Log Info, Warns and Errors
    /// </summary>
    public class Log
    {
        private static readonly ILog _logger = LogManager.GetLogger(Settings.Default.LogName);

        static Log()
        {
            XmlConfigurator.Configure(new FileInfo(Settings.Default.LogXMLSettings));
        }

        private Log()
        {            
        }

        /// <summary>
        /// Logs a Debug message
        /// </summary>
        /// <param name="text">message to log</param>
        public static void Debug(string text)
        {
            _logger.Debug(text);
        }

        /// <summary>
        /// Logs a Info message
        /// </summary>
        /// <param name="text">message to log</param>
        public static void Info(string text)
        {
            _logger.Info(text);
        }

        /// <summary>
        /// Logs a Warn message
        /// </summary>
        /// <param name="text">message to log</param>
        public static void Warn(string text)
        {
            _logger.Warn(text);
        }

        /// <summary>
        /// Logs a Error message
        /// </summary>
        /// <param name="text">message to log</param>
        public static void Error(string text)
        {
            _logger.Error(text);
        }

        /// <summary>
        /// Logs a Fatal message
        /// </summary>
        /// <param name="text">message to log</param>
        public static void Fatal(string text)
        {
            _logger.Fatal(text);
        }

    }
}